
//
//  HMAccountModel.m
//  weibo
//
//  Created by apple on 2016/11/17.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "HMAccountModel.h"

@implementation HMAccountModel
//将事件处理成nsdate
-(void)setExpires_in:(NSNumber *)expires_in{
    _expires_in = expires_in;
    
    _expires_date = [NSDate dateWithTimeIntervalSinceNow:expires_in.floatValue];
    
}

//写字典必须写这个
-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
}


//接档
-(instancetype)initWithCoder:(NSCoder *)aDecoder{
    
    if (self = [super init]) {
//        aDecoder decodeObjectForKey:<#(nonnull NSString *)#>
        self.access_token = [aDecoder decodeObjectForKey:@"access_token"];
        self.uid = [aDecoder decodeObjectForKey:@"uid"];
        self.expires_date = [aDecoder decodeObjectForKey:@"expires_date"];
        self.name = [aDecoder decodeObjectForKey:@"name"];
        self.avatar_large = [aDecoder decodeObjectForKey:@"avatar_large"];

    }
    
    return self;
}
#pragma mark
#pragma mark - 存档
-(void)encodeWithCoder:(NSCoder *)aCoder{
    [aCoder encodeObject:self.access_token forKey:@"access_token"];
    [aCoder encodeObject:self.uid forKey:@"uid"];
    [aCoder encodeObject:self.expires_date forKey:@"expires_date"];
    [aCoder encodeObject:self.name forKey:@"name"];
    [aCoder encodeObject:self.avatar_large forKey:@"avatar_large"];
}
//@property(nonatomic,copy)NSString *access_token;
//@property(nonatomic,copy)NSNumber *expires_in;
//@property(nonatomic,copy)NSString *uid;
//@property(nonatomic,strong) NSDate *expires_date;
//@property(nonatomic,copy)NSString *name;
//@property(nonatomic,copy)NSString *avatar_large;

@end
